#-*- coding:utf-8 -*-
import binascii
from module.ksw import Ksw

def main():
   ls= Ksw.getlist('http://m.00ksw.org/html/3/3479/all.html')
   str=""
   for x in ls:
         str=str+("%s")%handle(x)
   with open("./resource/%s.txt"% "亵渎~","w",encoding='utf-8') as f:
         f.write(str)

def handle(url):
     title=Ksw.getlisttitle(url)
     content="--->"+title+"<---\r\n"+Ksw.getcontent(url)
     entrycode=binascii.crc32(content.encode())
     print("%s----抓取成功"%title)
     return content
    
    
   # ls=Ksw.getcontent('http://m.00ksw.org/html/3/3479/1495982.html')
   # print(ls)
if(__name__=="__main__"):
    main()
